<!--
  ~ This program is part of the OpenLMIS logistics management information system platform software.
  ~ Copyright © 2013 VillageReach
  ~
  ~ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  ~  
  ~ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.
  ~ You should have received a copy of the GNU Affero General Public License along with this program.  If not, see http://www.gnu.org/licenses.  For additional information contact info@OpenLMIS.org. 
  -->

<div ng-controller="ViewFullSupplyController">
    <div ng-hide="page.fullSupply.length" class="alert alert-info" openlmis-message="label.no.products"></div>
    <div id="viewRnr" ng-show="page.fullSupply.length" class="rnr-table rnr-approval" adjust-height>
        <div class="float-left left-table">
            <table id="fullSupplyFrozenTable" class="table table-bordered" fixed-table-header>
                <thead>
                <tr>
                    <th class="col-{{column.name}}" ng-repeat="column in visibleColumns.fullSupply.fixed"
                        ng-bind="column.label"></th>
                </tr>
                </thead>

                <tbody ng-repeat="rnrLineItem in page.fullSupply">
                <tr>
                    <td id="category_{{$index}}" class="productCategory"
                        colspan="{{visibleColumns.fullSupply.fixed.length}}"
                        ng-show="showCategory($index)"
                        ng-bind="rnrLineItem.productCategory"></td>
                </tr>
                <tr>
                    <td class="cell-input col-{{ column.name }}" ng-repeat="column in visibleColumns.fullSupply.fixed">
            <span ng-switch on="column.name">
              <span ng-switch-when="skipped">
                <input ng-model="rnrLineItem[column.name]" id="skip_{{$parent.$parent.$index}}"
                       ng-disabled="true" type="checkbox">
              </span>
              <span ng-switch-default ng-bind="rnrLineItem[column.name]" id="{{getId(column.name, $parent)}}"
                    class="cell-text"></span>
            </span>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
        <div class="float-left right-table" custom-horizontal-scroll>
            <table id="fullSupplyTable" fixed-table-header class="table table-bordered scrollable">
                <thead>
                <tr>
                    <th class="col-{{column.name}}" ng-repeat="column in visibleColumns.fullSupply.scrollable"
                        ng-bind="column.label"></th>
                </tr>
                </thead>
                <tbody ng-repeat="rnrLineItem in page.fullSupply">
                <tr>
                    <td class="productCategory" colspan="{{visibleColumns.fullSupply.scrollable.length}}"
                        ng-show="showCategory($index)"></td>
                </tr>
                <tr>
                    <td class="cell-input col-{{ column.name }}"
                        ng-repeat="column in visibleColumns.fullSupply.scrollable">
            <span ng-switch on="column.name">
              <span ng-switch-when="lossesAndAdjustments">
                <div>
                    <a href="" ng-click="showLossesAndAdjustments(rnrLineItem)" class="rnr-adjustment">
                        <span ng-bind="rnrLineItem.totalLossesAndAdjustments" class="adjustment-value"></span>
                    </a>
                </div>
              </span>

              <span ng-switch-when="price">
                <span ng-bind='rnrLineItem[column.name] | currency:currency' id="{{getId(column.name, $parent)}}"
                      class="cell-text"></span>
              </span>

              <span ng-switch-when="cost">
                <span ng-bind='rnrLineItem[column.name] | currency:currency' id="{{getId(column.name, $parent)}}"
                      class="cell-text"></span>
              </span>


              <span ng-switch-default ng-bind="rnrLineItem[column.name]" id="{{getId(column.name, $parent)}}"
                    class="cell-text"></span>
            </span>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
        <div class="clear-both"></div>
    </div>

    <ng-include src="'/public/pages/logistics/rnr/partials/approve/losses-and-adjustments.html'"></ng-include>
</div>